<template>
    <div class="myCollection-root">
        <public-header>
            <i slot="icon" class="icon-chevron-left" @click="change"></i>
            <p slot="text" class="title">我的分享</p>
        </public-header>
        <div class="myCollection-content">
            <div class="content-wrap" v-for="s in share">
                <router-link :to="'/everylist/'+s.id">
                    <img class="homeItem" :src="s.author.avatar_url" alt="">
                    <span class="author-name">{{s.author.loginname}}</span>
                    <p class="collect-title">{{s.title}}</p> 
                    <div ></div>                                                                                                
                    <p class="collect-reply">发表时间：{{time}}</p>
                </router-link>
             </div>     
        </div>
    </div>
</template>

<script>
    import PublicHeader from '../components/Header'
    export default{
        data(){
            return{
                share:[],
                time:''
            }
        },
        components:{
            PublicHeader
        },
        methods:{
            change(){
                this.$router.go(-1)
            }
        },
        created(){
            var loginname=localStorage.getItem('loginname')  
            this.axios.get('/vueapi/v1/user/'+loginname)
            .then(data=>{
                this.share=data.data.data.recent_topics
                console.log(this.share)//数组
                this.time=data.headers.date
                //console.log(this.time)
            })
            .catch(err=>{
                console.log(err)
            })
        }
    }
</script>

<style scoped>
    .icon-chevron-left{
        font-size: 18px;
        margin-left: 20px;
        color: #fff;
    }
    .myCollection-content{
        padding: 64px 15px 0 15px;
    }
    .content-wrap{
        padding: 10px;
        border: 1px solid #e3e4e5;
        border-radius: 10px;
        margin-bottom: 15px;
        box-shadow: 0 1px 10px rgba(0,0,0,.2);
    }
    p.collect-reply,p.collect-title{
        margin: 10px 0;
    }
    .collect-title{
        font-size: 18px;
    }
</style>